webpackJsonp([17],{

/***/ 0:
/***/ function(module, exports, __webpack_require__) {

	var url = __webpack_require__(10);
	var template = __webpack_require__(11);
	var main = __webpack_require__(13);
	var form = __webpack_require__(20);
	var module = __webpack_require__(21);

	//模板配置
	var tplArr = [];
	var modalTpl = __webpack_require__(18);
	var detailTpl = __webpack_require__(35);
	tplArr['modal'] = template.compile(modalTpl.replace(/^\s*|\s*$/g, ""));
	tplArr['detail'] = template.compile(detailTpl.replace(/^\s*|\s*$/g, ""));

	function Detail() {
	    _this = this;
	    this.main = function () {
	        main.event(this, 'tap', 'i-click');
	        this.init();
	    };

	    this.getContent = function (id, url, postUrl) {
	        main.get(url, { product_id: id }, function (res) {
	            var ret = res.data[0];
	            console.info(res);
	            var property = {
	                "color": ret.color,
	                "cup": ret.cup_type_array,
	                "size": ret.size_type_array
	            };
	            var data = {
	                tType: "content",
	                title: ret.brand_name,
	                subtitle: ret.product_name,
	                attr: ret.value_img_array,
	                price: ret.money,
	                property: module.getModule(property, "property"),
	                description: _this.html_encode(ret.description),
	                pic: ret.good_img_array,
	                product_id: ret.product_id,
	                postUrl: postUrl
	            };
	            $(".content").html(tplArr['detail'](data));
	            //$("#html_section").html(ret.description);
	            //document.getElementById("html_section").innerHTML= ret.description;
	            //console.info(_this.html_encode(ret.description))
	            _this.slider();
	        });
	    };
	    //解码
	    this.html_encode = function (str) {
	        var s = "";
	        if (str.length == 0) return "";
	        s = str.replace(/&gt;/g, ">");
	        s = s.replace(/&lt;/g, "<");
	        s = s.replace(/ /g, " ");
	        s = s.replace(/\'/g, "'");
	        s = s.replace(/\"/g, '"');
	        s = s.replace(/\n/g, "<br>");
	        return s;
	    };

	    this.getFoot = function () {
	        main.post(url.getCount, {}, function (ret) {
	            console.info(ret);
	            var data = {
	                tType: "footer",
	                active: "0",
	                num: ret.data,
	                cart: _this.jumpUrl,
	                index: _this.indexUrl
	            };
	            $(".wrap").append(tplArr['detail'](data));
	        });
	    };
	    //轮播
	    this.slider = function () {
	        var slider = new fz.Scroll('.ui-slider', {
	            role: 'slider',
	            indicator: true,
	            autoplay: true,
	            interval: 3000
	        });
	    };
	    this.starClick = function (ths) {
	        ths.toggleClass("on");
	    };

	    //修改数量
	    this.changeCount = function (ths, type) {
	        var num = parseInt(ths.siblings(".quantity").val());
	        if (type == 1) {
	            ths.siblings(".quantity").val(++num);
	        } else if (num > 1) {
	            ths.siblings(".quantity").val(--num);
	        }
	    };

	    //加入购物车
	    this.addCart = function (ths, type) {
	        _this.addCarttype = type;
	        form.ajaxSubmit(".postForm", _this, ths);
	    };
	    this.formCallback = function (ret) {
	        if (ret.code == 1) {
	            console.info(_this.addCarttype);
	            if (_this.addCarttype == 0) {
	                window.location.href = _this.jumpUrl;
	            } else {
	                main.alert({
	                    "title": "提示",
	                    "content": "加入购物车成功!"
	                });

	                var _n = parseInt($(".ui-badge-cornernum").html());
	                _n++;
	                $(".ui-badge-cornernum").html(_n);
	            }
	        }
	    };

	    this.init = function () {
	        this.productid = main.GetQueryString("id");
	        this.getUrl = url.getProductInfo;
	        this.postUrl = url.postAddCart;
	        this.jumpUrl = "shop-cart";
	        this.indexUrl = "index";
	        this.getFoot();
	        this.getContent(this.productid, this.getUrl, this.postUrl);
	    };
	    return this.main();
	};

	var detail = new Detail();

/***/ },

/***/ 20:
/***/ function(module, exports, __webpack_require__) {

	var url = __webpack_require__(10);
	var template = __webpack_require__(12);
	var main = __webpack_require__(13);
	var modalTpl = __webpack_require__(18);

	//模板配置
	var tplArr = [];
	template.config('escape', false);
	tplArr['modal'] = template.compile(modalTpl.replace(/^\s*|\s*$/g, ""));

	//获取验证码
	function getCode(_dom, url, id) {
	  var _mobile = $('input[name="mobile"]').val();
	  var code = $('input[name="code"]').val();
	  if (_dom.text() != '获取验证码') {
	    return false;
	  }
	  if (_mobile == "") {
	    jsAlert('请输入手机号码');
	  } else if (/^1[3|4|5|7|8]\d{9}$/.test(_mobile) == false) {
	    jsAlert('手机号码格式有误');
	  } else {
	    _dom.text("校验中");
	    $.post(url, { "user_id": id, "mobile": _mobile }, function (json, textStatus) {
	      _json = json;
	      if (_json.code == 1) {
	        var tm = 60;
	        var tmr = setInterval(function () {
	          tm--;
	          if (tm > 0) {
	            _dom.text(tm + "秒");
	          } else {
	            _dom.text('获取验证码');
	            clearInterval(tmr);
	            tm = 60;
	            //_dom.attr('onclick','join.getCode()')
	          }
	        }, 1000);

	        jsAlert('验证码已发送');
	      } else if (_json.code == 2) {
	        jsAlert(_json.data);
	        _dom.text('获取验证码');
	      } else if (_json.code == 200) {
	        jsAlert(_json.data);
	        _dom.text('获取验证码');
	      }
	    }, 'json');
	  }
	}
	//弹窗
	function jsAlert(text, Fun) {
	  if (!Fun) {
	    Fun = 'm-click="modalAlertClose"';
	  }
	  var data = {
	    "type": "1",
	    "ico": 'warn',
	    "text": text,
	    "Callback": Fun
	  };
	  $('body').append(tplArr['modal'](data));
	}
	//表单数据整理
	// function ajaxSubmit_o(obj,module,but) {

	//   //var url = $(obj).attr("action") || window.location.href;
	//   var callback_name = $(obj).attr("callback");
	//   var url = $(obj).attr("action");
	//   var data = {};
	//   var ipts = {};
	//   $('input[name],textarea[name],select[name]',obj).each(function(item){
	//       var name = $(this).attr('name');
	//       var value = $(this).val();
	//       var ipt = $(this).attr('ipt');
	//       var isArray = /\[\]$/;
	//       if(isArray.test(name)){
	//           if(!data[name]){data[name]=[]}
	//           if(!ipts[name]){ipts[name]=[]}
	//           data[name].push(value);
	//           ipts[name].push(value,ipt);
	//       }else{
	//           data[name] = value;
	//           ipts[name] = [value,ipt];
	//       }
	//   });

	//   if(!yzForm(ipts)){return false;}
	//   but.attr('isSubmit','false').text('提交中...');
	//   $.ajax({
	//       url: url,
	//       type: "get",
	//       data: data,
	//       dataType: "json",
	//       success: function(ret){
	//           //if(ret.sms_success == "1"){
	//               //if(isNotEmpty(callback)) {
	//                 //_this.id = ret.success_id;
	//                 //jsConfirm('提示','请您确认所有填写的信息准确无误！',callback_name);
	//                 module[callback_name](ret);
	//               //}
	//           //}else if(ret.sms_success == "0"){
	//               //jsAlert("验证码错误");
	//           //}
	//       },
	//       error:function(ret){

	//       }
	//   });
	// }
	//表单数据整理
	function ajaxSubmit(obj, module, but) {
	  //console.info(module)
	  var but_val = but.html();
	  if (but_val == "提交中...") {
	    console.info("频次太快");
	    return false;
	  }
	  //var url = $(obj).attr("action") || window.location.href;
	  var callback_name = $(obj).attr("callback");
	  var url = $(obj).attr("action");
	  var formtype = $(obj).attr("f-type");
	  var data = {};
	  var ipts = {};
	  $('input[name],textarea[name],select[name]', obj).each(function (item) {
	    var name = $(this).attr('name');
	    var value = $(this).val();
	    var ipt = $(this).attr('ipt');
	    var isArray = /\[\]$/;
	    if (isArray.test(name)) {
	      if (!data[name]) {
	        data[name] = [];
	      }
	      if (!ipts[name]) {
	        ipts[name] = [];
	      }
	      data[name].push(value);
	      ipts[name].push(value, ipt);
	    } else {
	      data[name] = value;
	      ipts[name] = [value, ipt];
	    }
	  });

	  if ($("input[name='is_default']:checked").length == 1) {
	    data.is_default = 1;
	  } else {
	    data.is_default = 0;
	  }

	  if (!yzForm(ipts)) {
	    return false;
	  }
	  but.attr('isSubmit', 'false').html('提交中...');

	  //console.info(data)
	  data.openid = openid;
	  // $("body").html(data.serverId);
	  $.ajax({
	    url: url, //+"?openid_test=ojtKJjq93sF3dOoz4lA12MrxtcUk",
	    type: "post",
	    data: data,
	    dataType: "json",
	    success: function (ret) {
	      // console.info(ret)
	      //if(ret.sms_success == "1"){
	      //if(isNotEmpty(callback)) {
	      //_this.id = ret.success_id;
	      //jsConfirm('提示','请您确认所有填写的信息准确无误！',callback_name);
	      module[callback_name](ret);
	      but.html(but_val);
	      //}
	      //}else if(ret.sms_success == "0"){
	      //jsAlert("验证码错误");
	      //}
	    },
	    error: function (ret) {
	      but.html(but_val);
	      console.info(ret);
	    }
	  });
	}
	//方法验证
	function yzForm(data) {
	  var Ctrue = true;
	  var hour = $('select[name="sendplan_hour"]').val();
	  for (ipt in data) {
	    if (data[ipt][1] == 'true') {
	      continue;
	    }
	    switch (ipt) {

	      case 'name':
	        if (data[ipt][0] == "") {
	          isCtrue('请输入名字');return false;
	        }
	        break;

	      case 'mobile':
	        if (data[ipt][0] == "") {
	          isCtrue('请输入手机号码');return false;
	        } else if (/^1[3|4|5|7|8]\d{9}$/.test(data[ipt][0]) == false) {
	          isCtrue('手机号码格式有误');return false;
	        }
	        break;

	      case 'address':
	        if (data[ipt][0] == "") {
	          isCtrue('请输入详细地址');return false;
	        }
	        break;
	      case 'shipping_id':
	        if (data[ipt][0] == "") {
	          isCtrue('请选择物流');return false;
	        }
	        break;
	      case 'shipping_number':
	        if (data[ipt][0] == "") {
	          isCtrue('请填写物流单号');return false;
	        }
	        break;

	      // case 'is_default':
	      //    if(data[ipt][0]==""){isCtrue('请选择');return false;}
	      // break;
	    }
	  }
	  function isCtrue(text) {
	    Ctrue = false;
	    main.alert({
	      "title": "提示",
	      "content": text
	    });
	  };
	  return Ctrue;
	}

	exports.getCode = getCode;
	exports.jsAlert = jsAlert;
	exports.ajaxSubmit = ajaxSubmit;
	exports.yzForm = yzForm;

/***/ },

/***/ 35:
/***/ function(module, exports) {

	module.exports = "{{if tType== \"content\"}}\n<form action=\"{{postUrl}}\" class=\"postForm\" callback=\"formCallback\">\n<div class=\"product_info\">\n    <input type=\"hidden\" name=\"id\" value=\"{{product_id}}\">\n    <h3>{{title}}<br>{{subtitle}}</h3>\n    <h5 class=\"\">属性: \n        {{each attr as v i}}\n            <span class=\"attr\" style=\"background-image:url({{v}})\"></span>\n        {{/each}}\n    </h5>\n    <h5 class=\"\">微店价:<span>￥{{price}}</span></h5><!-- \n    <i class=\"ui-icon-star\" i-click=\"starClick\"></i> -->\n</div>\n<!-- 轮播图 -->\n<div class=\"ui-slider\">\n    <ul class=\"ui-slider-content\" style=\"width: 300%\">\n    {{each pic as v i}}\n        <li><span style=\"background-image:url({{v}})\"></span></li> \n    {{/each}}\n    </ul>\n</div>\n<div class=\"product_select\">\n    {{property}}\n</div>\n<div class=\"productDeatil\">\n    <div class=\"cm_title ui-border-t\">商品详情</div>\n    <div class=\"html_section\" id=\"html_section\">{{description}}</div>\n</div>\n</form>\n{{/if}}\n{{if tType== \"footer\"}}\n<footer id=\"footer\" class=\"ui-footer ui-footer-stable\">\n    <ul class=\"foot_list ui-tiled w45 fl\">\n        <li>\n            <a href=\"{{index}}\">\n                <i class=\"ui-icon-home\"></i>\n                首页\n            </a>\n        </li>\n        <li>\n            <a href=\"{{cart}}\" class=\"ui-badge-wrap\">\n                {{if num}}<div class=\"ui-badge-cornernum\">{{num}}</div>{{/if}}\n                <i class=\"ui-icon-cart\"></i>\n                购物车\n            </a>\n        </li>\n    </ul>\n    <ul class=\"ui-row w55 fl\">\n        <li i-click=\"addCart,1\" class=\"ui-col ui-col-50 list-pink\">加入购物车</li>\n        <li i-click=\"addCart,0\" class=\"ui-col ui-col-50\">立即购买</li>\n    </ul>\n</footer> \n{{/if}}\n"

/***/ }

});